#include "Blocks/GravelBlock.h"
#include "Blocks/StoneChunkBlock.h"
#include "GameSingleton.h"
#include "GameRandom.hpp"

namespace PocketSurvival
{
    int32_t GravelBlock::getIndex()
    {
        return Index();
    }
    const std::string &GravelBlock::getBlockName()
    {
        static std::string blockName = "GravelBlock";
        return blockName;
    }

    void GravelBlock::getDropValues(int32_t oldValue, int32_t newValue, int32_t toolLevel, std::vector<BlockDropValue> &dropValues)
    {
        if (toolLevel < RequiredToolLevel)
        {
            return;
        }
        if (GameSingleton::gameRandom->getFloat(0.0f, 1.0f) < 0.33f)
        {
            Block::getDropValues(oldValue, newValue, toolLevel, dropValues);
            return;
        }
        int32_t num = GameSingleton::gameRandom->getInt(1, 3);
        for (int32_t i = 0; i < num; i++)
        {
            dropValues.push_back(BlockDropValue{StoneChunkBlock::Index(), 1});
        }
    }

} // namespace PocketSurvival
